/**
 * Created by on 2016/10/25.
 */

    var logger = require('pomelo-logger').getLogger(__filename);

var Room = function(opts){
    this.roomId = opts.id;
    this.type = this.type;
    this.players = {};  //player cache //不一定是最新的
    this.seats = {};
}

module.exports = Room;

var proto = Room.prototype;

proto.addUser = function(player) {
    if(!this.players[player.id]) {
        this.players[player.id] = player;
        this.onLogin();
    }
    else {
        if(this.players[player.id] == player) {
            this.reLogin();
            logger.log("重新登录");
        } else {
            this.players[player.id] = player;   //重新赋值
            console.log(logger);
        }
    }
}

proto.removeUser = function (player) {

}

proto.removeUserById = function(id) {

}

proto.disbandRoom = function() {
}

proto.onLogin = function() {

}

proto.onLogOut = function() {

}

proto.reLogin = function() {

}


